/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.netcracker.test.nine;

/**
 *
 * @author I
 */
public class Pers implements Comparable<Pers> {
    private String name;
    private String surname;
    private String patronimyc;
    public Pers(String n, String s, String p)
    {
        name =n;
        surname = s;
        patronimyc = p;
    }
    public void setName(String n)
    {
        name=n;
    
    }
    public String getName()
    {
        return name;
    }
    public void setSurname(String s)
    {
        surname=s;
    
    }
    public String getSurname()
    {
        return surname;
    }
    public void setPatronimyc(String p)
    {
        patronimyc=p;
    
    }
    public String getPatronymic()
    {
        return patronimyc;
    }

    @Override
    public int compareTo(Pers o) {
        //return name.compareTo(o.getName());
        int result;
        result = name.compareTo(o.getName());
        if(result==0)
        {
            result = surname.compareTo(o.getSurname());
            if(result==0)
            {
                result = patronimyc.compareTo(o.getPatronymic());
                return result;
            }
            else
                return result;
        }
        else 
            return result;  
    }
    
}
